'''
''' This method is called when a page is loaded. This method will
''' Populate the DataGrid.
'''
''' The object that raised the load event.
''' The object that contains the event data of the load event.
Private Sub MyPageLoad(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
If Not (Me.IsPostBack) Then
Dim myDataGrid As System.Web.UI.WebControls.DataGrid = CType(Me.FindControlRecursively("myDataGrid"), System.Web.UI.WebControls.DataGrid)
' If DataGrid is found then populate it.
If (Not myDataGrid Is Nothing) Then
' example of where clause is
' whereStr = " myNumericField = 1"
' whereStr = " myStrField = '1'"
Dim whereStr as String = Nothing
' Create orderBy clause
Dim ob As BaseClasses.Data.OrderBy = Nothing
' Set page index and size
Dim pageIndex as Integer = 0
Dim pageSize as Integer = 1000
' Retrieving first 1000 records.
' Bind the result set to the DataGrid.
myDataGrid.DataSource = ${${Table Name}ClassName}.GetDataTable(whereStr, ob, pageIndex, pageSize)
myDataGrid.DataBind
End If
End If
End Sub
|